<template>
  <el-dialog v-model="visible" modal-class="audit-dialog" width="900" align-center center :show-close="false">
    <div class="alert" v-if="['down', 'reListed', 'up'].includes(batchType)">
      <el-icon>
        <WarningFilled />
      </el-icon>
      <div>{{ batchText[batchType].tip }}</div>
    </div>
    <el-scrollbar max-height="400px">
      <slot name="list"></slot>
    </el-scrollbar>
    <template #footer>
      <div class="dialog-footer">
        <div>
          <el-button @click="visible = false">取消</el-button>
          <el-button type="primary" @click="confirmBatch[batchType]">
            {{ batchText[batchType].btnText }}
          </el-button>
        </div>
      </div>
    </template>
  </el-dialog>
</template>

<script setup>
import { computed } from "vue";
import { batchText } from "../config";

const props = defineProps({
  batchVisible: {
    type: Boolean,
    default: false
  },
  goodsList: {
    type: Array,
    default: () => []
  },
  batchType: {
    type: String
  },
  confirmBatch: {
    type: Object
  }
});
const emit = defineEmits(["update:batchVisible"]);
const visible = computed({
  get() {
    return props.batchVisible;
  },
  set(value) {
    emit("update:batchVisible", value);
  }
});
</script>

<style scoped lang="scss">
.audit-dialog {
  .goods-detail {
    margin-bottom: 20px;
  }
}

.alert {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 54px;
  margin: 0 0 10px;
  background: #ffd9c2;
  border-radius: 6px;

  .el-icon {
    color: #e37318;
    margin: 0 10px;
  }
}

.dialog-footer-flex {
  display: flex;
  justify-content: space-between;
}
</style>
